<template>
<div>
    <div class="title">
        TestAxios
    </div>
   <ul>
       <li class="item" v-for="item of list"  :key="item.id">
           <img class="item-img" :src="attachImageUrl(item.images[0])" />
           <div class="item-info">
          <p class="item-title">{{item.title}}</p>
          <p class="item-desc">{{item.desc}}</p>
          <button class="item-button">查看详情</button>
        </div>
       </li>
   </ul>
</div>
</template>
<script>
export default {
  name: 'testAxios',
  props: {
    list: Array
  },
  methods: {
    attachImageUrl: function (srcUrl) {
      if (srcUrl !== undefined) {
        return srcUrl.replace(/http\w{0,1}:\/\/p/g, 'https://images.weserv.nl/?url=p')       
      }
    }
  }
}
</script>
